﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.ComponentModel;

namespace BYRForum.Binding.Thread
{
    public class ThreadsItem
    {
        private String _groupid;
        public String GroupID
        {
            get
            {
                return _groupid;
            }
            set
            {
                if (value != _groupid)
                {
                    _groupid = value;
                    NotifyPropertyChanged("GroupID");
                }
            }
        }

        private String _title;
        public String Title
        {
            get
            {
                return _title;
            }
            set
            {
                if (value != _title)
                {
                    _title = value;
                    NotifyPropertyChanged("Title");
                }
            }
        }

        private String _username;
        public String UserName
        {
            get
            {
                return _username;
            }
            set
            {
                if (value != _username)
                {
                    _username = value;
                    NotifyPropertyChanged("UserName");
                }
            }
        }

        private String _boardname;
        public String BoardName
        {
            get
            {
                return _boardname;
            }
            set
            {
                if (value != _boardname)
                {
                    _boardname = value;
                    NotifyPropertyChanged("BoardName");
                }
            }
        }

        private String _showboardname;
        public String ShowBoardName
        {
            get
            {
                return _showboardname;
            }
            set
            {
                if (value != _showboardname)
                {
                    _showboardname = value;
                    NotifyPropertyChanged("ShowBoardName");
                }
            }
        }

        private String _lastreplytime;
        public String LastReplyTime
        {
            get
            {
                return _lastreplytime;
            }
            set
            {
                if (value != _lastreplytime)
                {
                    DateTime dtStart = new DateTime(1970, 1, 1);
                    long lTime = long.Parse(value + "0000000");
                    TimeSpan toNow = new TimeSpan(lTime);
                    DateTime dtResult = dtStart.Add(toNow);

                    _lastreplytime = "最后回复" + dtResult.ToString("yyyy-MM-dd HH:mm:ss"); ;
                    NotifyPropertyChanged("LastReplyTime");
                }
            }
        }
        

        public event PropertyChangedEventHandler PropertyChanged;
        private void NotifyPropertyChanged(String propertyName)
        {
            PropertyChangedEventHandler handler = PropertyChanged;
            if (null != handler)
            {
                handler(this, new PropertyChangedEventArgs(propertyName));
            }
        }
    }
}
